/*
 * Copyright © 2023
 * @Author: zhangxiang
 * @Date: 2023-06-14 15:55:40
 * @LastEditors: zhangxiang
 * @LastEditTime: 2023-06-28 17:00:16
 * @Description: 自智运维 相关接口
 * 来源：调度平台cnap-V2.1 自智运维：健康诊断、优化建议
 * 前缀 /cnap/vmInfo
 *
 */

import request from '@/utils/request'

const PREFIX = '/cnap'

/**
 * @description: 查询智能告警阈值
 * @param {*} data
 * @return {*}
 */
export function getIntelligentAlarmThreshold(data) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/scaling/intelligent/threshold',
    method: 'post',
    data
  })
}

/**
 * @description: 查询 健康诊断-风险项
 * @param {*} data
 * @return {*}
 */
export function getHealthAlarmList(data) {
  return request({
    url: PREFIX + '/monitor/statistic/alarm/risk/list',
    method: 'post',
    data
  })
}

/**
 * @description: 查询健康诊断系统表现
 * @param {*} params
 * @return {*}
 */
export function getHealthPerformance(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/value',
    method: 'get',
    params
  })
}

/**
 * @description: 获取所有云的类型
 * @param {*} params
 * @return {*}
 */
export function getAllCloudVendors(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAllCloudVendors',
    method: 'get',
    params
  })
}

/**
 * @description: 获取所有集群的region
 * @param {*} params
 * @return {*}
 */
export function getAllUseRegion(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAllUseRegion',
    method: 'get',
    params
  })
}

/**
 * @description: 获取所有集群的zone
 * @param {*} params
 * @return {*}
 */
export function getAllUseZone(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAllUseZone',
    method: 'get',
    params
  })
}

/**
 * @description: 查询所有部署了的集群
 * @param {*} params
 * @return {*}
 */
export function getAllClusterName(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAllClusterName',
    method: 'get',
    params
  })
}

/**
 * @description: 查询所有微服务
 * @param {*} params
 * @return {*}
 */
export function getAllMicroSvcName(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAllMicroSvcName',
    method: 'get',
    params
  })
}

/**
 * @description: 获取集群和微服务的情况
 * @param {*} params
 * @return {*}
 */
export function getClusterMicroSvcInfos(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getClusterMicroSvcInfos',
    method: 'get',
    params
  })
}

/**
 * @description: 获取微服务的使用情况
 * @param {*} params
 * @return {*}
 */
export function getMicroSvcUseInfo(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getMicroSvcUseInfo',
    method: 'get',
    params
  })
}

/**
 * @description: 获取指定集群下，若干微服务的cpu使用率和请求响应时间
 * @param {*} data
 * @return {*}
 */
export function getAlarmSvcInfo(data) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getAlarmSvcInfo',
    method: 'post',
    data
  })
}

/**
 * @description: 获取微服务的cpu风险预测
 * @param {*} params
 * @return {*}
 */
export function getCpuRiskTrends(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getCpuRiskTrends',
    method: 'get',
    params
  })
}

/**
 * @description: 查看算网度量模型参数优化区域
 * @param {*} params
 * @return {*}
 */
export function getOptTrends(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getOptTrends',
    method: 'get',
    params
  })
}

/**
 * @description: 获取知识库信息
 * @param {*} data
 * @return {*}
 */
export function getKnowledge() {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/knowledge',
    method: 'get'
  })
}

/**
 * @description: 获取获取健康度
 * @param {*} data
 * @return {*}
 */
export function getHealth() {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/value',
    method: 'get'
  })
}

/**
 * @description: 获取根因列表
 * @param {*} data
 * @return {*}
 */
export function getCauseList(data) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/clusterInfo/cause/list',
    method: 'post',
    data
  })
}

/**
 * @description: 删除根因
 * @param {*} deleteId
 * @return {*}
 */
export function deleteCause(deleteId) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/clusterInfo/cause/delete/' + deleteId,
    method: 'delete'
  })
}

/**
 * @description: 获取大屏消息中心的情况
 * @param {*} params
 * @return {*}
 */
export function getMsgCenterInfos(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/getMsgCenterInfos',
    method: 'get',
    params
  })
}

/**
 * @description: 删除消息中心的消息
 * @param {*} params
 * @return {*}
 */
export function delMsgCenterInfo(params) {
  return request({
    url: PREFIX + '/cnap/multicloudmgmt/v1/health/delMsgCenterInfo',
    method: 'delete',
    params
  })
}
